#ifndef QUEUE_H
#define QUEUE_H
#include <stdio.h>
#include <stdlib.h>

void errif(int result, const char *msg);

//linked list queue
typedef struct _QueueNode {
    int data;
    struct _QueueNode *next;
}QueueNode;

typedef struct _Queue {
    QueueNode *head;
    QueueNode *tail;
}Queue;

Queue *Queue_Create();
void Queue_Destroy(Queue *queue);
void Queue_Enqueue(Queue *queue, int data);
int Queue_Dequeue(Queue *queue);
int Queue_Size(Queue *queue);


//dequeue     
//double_ended_queue
typedef struct _DequeueNode {
    struct _DequeueNode* pre;
    struct _DequeueNode* next;
    int data;
}DequeueNode;

typedef struct _Dequeue {
    DequeueNode *head;
    DequeueNode *tail;
}Dequeue;

Dequeue *Dequeue_Create();
void Dequeue_Destroy(Dequeue *dequeue);

void Dequeue_push_front(Dequeue *dequeue, int data);
int Dequeue_pop_front(Dequeue *dequeue);

void Dequeue_push_back(Dequeue *dequeue, int data);
int Dequeue_pop_back(Dequeue *dequeue);

int Dequeue_Size(Dequeue *dequeue);

#endif  